package chianghao.springboot.start.web.properties;

import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "chianghao.mvc", ignoreUnknownFields = true)
public class SpringMvcProperties {

	/**
	 * 最大上床文件大小，单位字节
	 */
	private long maxUploadSize;

	private String[] i18nFileNames;
	
	private String language;
	
	private String swaggerScanPack;
	
	
	public String getLanguage() {
		if(StringUtils.isEmpty(language)) {
			return "zh_CN";
		}
		return language;
	}
	
	
	public String getSwaggerScanPack() {
		if(StringUtils.isNotBlank(swaggerScanPack)) {
			return swaggerScanPack;
		}
		return "com.chianghao";
	}

	public void setSwaggerScanPack(String swaggerScanPack) {
		this.swaggerScanPack = swaggerScanPack;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String[] getI18nFileNames() {
		return i18nFileNames;
	}

	public void setI18nFileNames(String[] i18nFileNames) {
		this.i18nFileNames = i18nFileNames;
	}

	public long getMaxUploadSize() {
		if(maxUploadSize==0){
			return 8388608L;
		}
		return maxUploadSize;
	}

	public void setMaxUploadSize(long maxUploadSize) {
		this.maxUploadSize = maxUploadSize;
	}

}
